import { IsEnum, IsOptional, IsString, IsMongoId } from 'class-validator';
import { Muscles, MuscleGroup, Tool } from 'src/types/motion';
import { Types } from 'mongoose';

export default class OptionalDto {
  @IsOptional()
  @IsEnum(Muscles, { each: true, message: '无效mainPart' })
  mainPart?: Muscles[];

  @IsOptional()
  @IsEnum(Muscles, { each: true, message: '无效minorPart' })
  minorPart?: Muscles[];

  @IsOptional()
  @IsEnum(MuscleGroup, { each: true, message: '无效group' })
  group?: MuscleGroup;

  @IsOptional()
  @IsEnum(Tool)
  tool?: Tool;

  @IsOptional()
  @IsString()
  img?: string;

  @IsOptional()
  @IsString()
  description?: string;

  @IsOptional()
  @IsMongoId()
  userId?: Types.ObjectId;
}
